/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Xadrez.Modelo;

/**
 *
 * @author Jéssica
 */
public class Move {

    private Square origin;
    private Square destination;
    private boolean originDifDestination;


    public Move(){

    }

    public Move(Square o, Square d){

        this.setOrigin(o);
        this.setDestination(d);

        if ( o.getPositionX() == d.getPositionX()
                && o.getPositionY() == d.getPositionY() ){
            this.setOriginDifDestination(false);
        }
        else this.setOriginDifDestination(true);


    }

    public Square getOrigin(){
        return this.origin;
    }

    public Square getDestination(){
        return this.destination;
    }

    public void setOrigin(Square o){
        this.origin = o;
    }

    public void setDestination(Square d){
        this.destination = d;
    }

    private void setOriginDifDestination(boolean b) {
        this.originDifDestination = b;
    }

    private boolean getOriginDifDestination(){
        return this.originDifDestination;
    }

    public boolean onLimits(){
        if((this.getOrigin().getPositionX()>7)
                ||(this.getOrigin().getPositionX()<0)
                ||(this.getOrigin().getPositionY()>7)
                ||(this.getOrigin().getPositionY()<0)
                ||(this.getDestination().getPositionX()<0)
                ||(this.getDestination().getPositionX()>7)
                ||(this.getDestination().getPositionY()<0)
                ||(this.getDestination().getPositionY()>7)){
            return false;

        } else return true;
    }

}
